import java.awt.Color;
import java.awt.image.BufferedImage;
import java.util.ArrayList;


public class EigenfaceMethod implements FeatureExtractionMethod
{
	//For implementation details, read the wikipedia article:
	//http://en.wikipedia.org/wiki/Eigenface
	
	Jama.Matrix T;
	Jama.Matrix T_transpose_T;
	
	EigenfaceMethod(ArtCollection artCollection)
	{
//		int artCount = 0;
//		for (ArtPiece piece : artCollection.iterator())
//		{
//			artCount += 1;
//		}
//		
//		int artIndex = 0;
//		int componentDataLength = 3 * ArtPiece.STORED_SIZE * ArtPiece.STORED_SIZE;
//		double[][] array = new double[artCount][componentDataLength];
//		double[] averageImage = new double [componentDataLength];
//		for (ArtPiece piece : artCollection.iterator())
//		{
//			BufferedImage image = piece.getImage();
//
//			int componentIndex = 0;
//			for (int x = 0; x < image.getWidth(); ++x)
//			{
//				for (int y = 0; y < image.getHeight(); ++y)
//				{
//					int rgb = image.getRGB(x, y);
//					Color color = new Color(rgb);
//					averageImage[componentIndex] += color.getRed();
//					array[artIndex][componentIndex++] = color.getRed();
//					averageImage[componentIndex] += color.getGreen();
//					array[artIndex][componentIndex++] = color.getGreen();
//					averageImage[componentIndex] += color.getBlue();
//					array[artIndex][componentIndex++] = color.getBlue();
//				}
//			}
//			++artIndex;
//		}
//		
//		for (int i = 0; i < componentDataLength; ++i)
//		{
//			averageImage[i] /= artCount;
//			for (artIndex = 0; artIndex < artCount; ++artIndex)
//			{
//				array[artIndex][i] -= averageImage[i];
//			}
//		}
//		
//		T = new Jama.Matrix(array);
//		T_transpose_T = T.transpose().times(T);
//		Jama.EigenvalueDecomposition eigDecomp = new Jama.EigenvalueDecomposition(T_transpose_T);
//		eigDecomp.
	}

	@Override
	public ArrayList<Double> process(BufferedImage image, int outputLength)
	{
		// TODO Auto-generated method stub
		return null;
	}

}
